package com.jiyun.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jiyun.pojo.ThContractInformation;
import com.jiyun.pojo.ThStoreInformation;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.jiyun.service.IThContractInformationService;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author usian
 * @since 2022-10-24
 */
@RestController
@RequestMapping("/contract_information")
@Api(tags = "接口")
@CrossOrigin
public class ThContractInformationController{

    @Autowired
    private IThContractInformationService thContractInformationService;

    /**
     * 查询合同详情信息
     * @param contractId
     * @return
     */
    @GetMapping("/findById/{id}")
    public ThContractInformation findById(@PathVariable("id") Integer contractId){
        if (contractId==null){
            throw new RuntimeException("参数为空");
        }
        LambdaQueryWrapper<ThContractInformation> queryWrapper=new LambdaQueryWrapper<>();
        queryWrapper.eq(contractId!=null,ThContractInformation::getContractId,contractId);
        ThContractInformation thContractInformation = thContractInformationService.getOne(queryWrapper);
        if (thContractInformation==null){
            throw new RuntimeException("查询信息为空");
        }
        return thContractInformation;
    }
}
